package com.yc.navy.spring;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.yc.navy.spring.bean.UserInfo;

public class AppTest {
	@Test
	public void Test1() {
		UserInfo uf = new UserInfo(1001, "张三", "你好！");
		System.out.println(uf);
		
		uf.showInfo();
	}
	
	@Test
	public void Test2() {
		// 实例化IoC容器
		ApplicationContext context = new ClassPathXmlApplicationContext("spring-beans.xml");
		// 从IoC容器中获取需要的对象
		UserInfo uf = (UserInfo) context.getBean("userInfo");
		System.out.println(uf);
		
		uf.showInfo();
	}
}
